﻿<Window x:Class="mitasoft.Books.Client.Desktop.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow"
        WindowStartupLocation="CenterScreen"
        WindowState="Maximized"
        WindowStyle="None"
        Height="600"
        Width="800"
        Loaded="Window_Loaded"
        Background="#B3000000"
        AllowsTransparency="True">
    <Grid Margin="30"
          Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <StackPanel Grid.Row="0"
                    Orientation="Horizontal">

            <Image Source="/documents.ico"
                   Width="32"
                   Height="32" />
            <Label  Content="BookStore"
                    VerticalAlignment="Center"
                    FontFamily="Consolas"
                    FontSize="14"
                    Foreground="White"
                    FontWeight="Bold">
                <Label.Effect>
                    <DropShadowEffect />
                </Label.Effect>
            </Label>
        </StackPanel>

        <!--<Menu Grid.Row="0">
            <MenuItem Header="Scan">
                <MenuItem Header="Scan folder" />
            </MenuItem>

            <MenuItem x:Name="menuCategories"
                      Header="Categories"
                      Click="menuCategories_Click" />
        </Menu>-->

        <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="35" />
                <RowDefinition Height="*" />
                <RowDefinition Height="200" />
                <RowDefinition Height="35" />
            </Grid.RowDefinitions>

            <StackPanel Grid.Row="0"
                        Orientation="Horizontal">

                <Button Content="Load directory"
                        x:Name="btnLoadDirectory"
                        Width="90"
                        Margin="0,5,5,5"
                        Click="btnLoadDirectory_Click" />

                <Button Content="Process books"
                        x:Name="btnProcess"
                        Width="90"
                        Margin="5"
                        Click="btnProcess_Click" />

                <Button Content="Pack"
                        x:Name="btnPack"
                        Width="90"
                        Margin="5"
                        Click="btnPack_Click" />

                <Button Content="Exit"
                        x:Name="btnExit"
                        Width="90"
                        Margin="5"
                        Click="btnExit_Click" />

            </StackPanel>

            <Grid Grid.Row="1">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="35" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <StackPanel Grid.Row="0"
                                Orientation="Horizontal"
                                VerticalAlignment="Center"
                                Background="#FFF0F0F0">
                        <Label Content="Name:" />
                        <TextBox x:Name="tbSearchNume"
                                 TextChanged="tbSearchNume_TextChanged"
                                 Width="150"
                                 Margin="0,5,0,5" />
                        <Label Content="Category:" />
                        <ComboBox x:Name="cbSearchCategory"
                                  SelectionChanged="cbSearchCategory_SelectionChanged"
                                  Width="150"
                                  Margin="0,5,0,5" />
                    </StackPanel>

                    <DataGrid Grid.Row="1"
                              x:Name="gridBooks"
                              AutoGenerateColumns="False"
                              Padding="5"
                              HorizontalGridLinesBrush="{x:Null}"
                              BorderBrush="{x:Null}"
                              CanUserAddRows="True"
                              RowHeight="25">
                        <DataGrid.RowDetailsTemplate>
                            <DataTemplate>

                                <Grid Margin="10"
                                      Height="50">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                        <ColumnDefinition />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition />
                                        <RowDefinition />
                                    </Grid.RowDefinitions>
                                    <Label Grid.Row="0"
                                           Grid.Column="0"
                                           Content="{Binding Path=FileName}"
                                           FontFamily="Consolas"
                                           FontWeight="Bold" />
                                    <StackPanel Grid.Row="1"
                                                Grid.Column="0"
                                                Orientation="Horizontal">

                                        <Button Width="150"
                                                x:Name="btnOpenFile"
                                                Click="btnOpenFile_Click"
                                                Content="Open file" />

                                        <ComboBox Width="150"
                                                  SelectedItem="{Binding Path=Category, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
                                                  ItemsSource="{DynamicResource ResourceKey=CategoryList}" />
                                    </StackPanel>
                                </Grid>
                            </DataTemplate>
                        </DataGrid.RowDetailsTemplate>
                        <DataGrid.RowBackground>
                            <LinearGradientBrush EndPoint="0.5,1"
                                                 StartPoint="0.5,0">
                                <GradientStop Color="#FFBABABA"
                                              Offset="0" />
                                <GradientStop Color="White"
                                              Offset="0.43" />
                                <GradientStop Color="White"
                                              Offset="0.599" />
                                <GradientStop Color="#FFBABABA"
                                              Offset="1" />
                            </LinearGradientBrush>
                        </DataGrid.RowBackground>
                        <DataGrid.Columns>

                            <DataGridTextColumn Header="Path"
                                                Binding="{Binding Path=FilePath, Mode=OneWay}"
                                                Width="*" />

                            <DataGridTextColumn Header="File Size (MB)"
                                                Binding="{Binding Path=FileSizeMB, Mode=OneWay}"
                                                Width="80" />

                            <DataGridTextColumn Header="Name"
                                                Width="*"
                                                Binding="{Binding Path=FileName, Mode=OneWay}" />

                            <DataGridTextColumn Header="Category"
                                                Binding="{Binding Path=Category, Mode=OneWay}"
                                                Width="*" />

                            <DataGridTextColumn Header="FileHash"
                                                Binding="{Binding Path=FileHash, Mode=OneWay}"
                                                Width="*" />

                            <DataGridTemplateColumn Header="Category">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <ComboBox SelectedItem="{Binding Path=Category, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
                                                  ItemsSource="{DynamicResource ResourceKey=CategoryList}">
                                        </ComboBox>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>

                        </DataGrid.Columns>
                    </DataGrid>
                </Grid>
            </Grid>

            <GridSplitter Grid.Row="2" />

            <ListBox x:Name="lstMessages"
                     Background="LightGray"
                     Grid.Row="2"
                     BorderBrush="{x:Null}"
                     BorderThickness="0"
                     Foreground="Black">

            </ListBox>

            <Grid VerticalAlignment="Center"
                  Grid.Row="3"
                  Margin="0,5,0,5">

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <ProgressBar x:Name="progressBar"
                             Width="150"
                             Margin="0,5,5,5"
                             IsIndeterminate="False" />

                <Label x:Name="statusMessage"
                       Visibility="Hidden"
                       Grid.Column="1"
                       VerticalAlignment="Center"
                       VerticalContentAlignment="Center"
                       Content="" />

                <Label x:Name="versionStatus"
                       Grid.Column="2"
                       Foreground="White"
                       FontFamily="Consolas"
                       FontWeight="Bold"
                       VerticalContentAlignment="Center"
                       VerticalAlignment="Center"
                       Content="" />
            </Grid>

        </Grid>
    </Grid>
</Window>
